package top.oneit.jdownload.test;

import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Clip;
import java.io.File;
import java.net.URI;

/**
 * @author lingkang
 * @date 2021/12/11
 */
public class MyMusic03 {
    public static void main(String[] args) throws Exception {
        //只能播放 wav 格式的music
        File file = new File("C:\\Users\\Administrator\\Desktop\\aoUner_-_231148159229145189230181129.wav");
        URI uri = file.toURI();
        System.out.println(uri);
        AudioInputStream audioIn = AudioSystem.getAudioInputStream(file);
        Clip clip = AudioSystem.getClip();
        clip.open(audioIn);
        clip.start();
        Thread.sleep(15000);
    }
}
